package com.luobo.behavior.strategy;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("strategy")
public class StrategyController {

    @GetMapping("test/{type}")
    public Object test(@PathVariable String type) {
        try {
            Color strategy = Context.getStrategy(type);
            return strategy.make();
        } catch (Exception e) {
            return e.getMessage();
        }
    }
}
